home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWPart / Include / FWIters.h < prev    next >
Encoding:
Text File  |  1996-04-25  |  9.1 KB  |  333 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWIters.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9. //
  10. //    This file contains the following iterators
  11. //
  12. //        - FW_CODFrameFacetIterator
  13. //
  14. //        - FW_CEmbeddedODFacetsIterator
  15. //            Iterates trought all the facets embedded in one of your display facet for a specific proxy.
  16. //            If the embedding facet is NULL,  returns all the embedded facets for a proxy.
  17. //
  18. //        - FW_CFacetIterator
  19. //            Wrapper for ODFacetIterator, safe for exception.
  20. //
  21. //        - FW_CFrameFacetIterator
  22. //            Allows you to iterator through all the facets of a display frame.
  23. //
  24. //        - FW_CPresentationFrameIterator
  25. //
  26. //        - FW_CPresentationFacetIterator
  27. //
  28. //        - FW_CFrameProxyFrameIterator
  29. //
  30. //        - FW_CFrameEmbeddedFrameIterator
  31. //
  32.  
  33. #ifndef FWITERS_H
  34. #define FWITERS_H
  35.  
  36. #ifndef FWSTDDEF_H
  37. #include "FWStdDef.h"
  38. #endif
  39.  
  40. #ifndef FWEXCLIB_H
  41. #include "FWExcLib.h"
  42. #endif
  43.  
  44. #ifndef FWPART_H
  45. #include "FWPart.h"
  46. #endif
  47.  
  48. #ifndef FWPROXY_H
  49. #include "FWProxy.h"
  50. #endif
  51.  
  52. #ifndef FWFRMING_H
  53. #include "FWFrming.h"
  54. #endif
  55.  
  56. #ifndef FWPRESEN_H
  57. #include "FWPresen.h"
  58. #endif
  59.  
  60. #ifndef FWPXYFRM_H
  61. #include "FWPxyFrm.h"
  62. #endif
  63.  
  64. #ifndef FWPRTITE_H
  65. #include "FWPrtIte.h"
  66. #endif
  67.  
  68. #ifndef FWORDCOL_H
  69. #include "FWOrdCol.h"
  70. #endif
  71.  
  72. // ----- OpenDoc Includes -----
  73.  
  74. #ifndef SOM_ODFacetIterator_xh
  75. #include <FacetItr.xh>
  76. #endif
  77.  
  78. #ifndef SOM_ODFocusSetIterator_xh
  79. #include "FocusItr.xh"
  80. #endif
  81.  
  82. #ifndef SOM_ODFrameFacetIterator_xh
  83. #include <FrFaItr.xh>
  84. #endif
  85.  
  86. //========================================================================================
  87. //    Forward Declarations
  88. //========================================================================================
  89.  
  90. class FW_CPart;
  91. class FW_CFrame;
  92. class FW_CEmbeddingFrame;
  93. class FW_CFrameFacetIterator;
  94. class ODFacet;
  95. class ODFrame;
  96.  
  97. //========================================================================================
  98. //    class FW_CODFrameFacetIterator
  99. //========================================================================================
  100.  
  101. class FW_CODFrameFacetIterator
  102. {
  103. public:
  104.     FW_DECLARE_AUTO(FW_CODFrameFacetIterator)
  105.  
  106.     FW_CODFrameFacetIterator(Environment* ev, ODFrame* odFrame);
  107.     virtual ~FW_CODFrameFacetIterator();
  108.  
  109.     ODFacet*        First(Environment* ev)
  110.                         {return fODFrameFacetIte->First(ev);}
  111.     ODFacet*        Next(Environment* ev)
  112.                         {return fODFrameFacetIte->Next(ev);}
  113.     
  114.     FW_Boolean        IsNotComplete(Environment* ev)
  115.                         {return fODFrameFacetIte->IsNotComplete(ev);}
  116.  
  117. private:
  118.     ODFrameFacetIterator     *fODFrameFacetIte;
  119. };
  120.  
  121. //========================================================================================
  122. //    class FW_CFrameFacetIterator
  123. //========================================================================================
  124.  
  125. class FW_CFrameFacetIterator : public FW_CODFrameFacetIterator
  126. {
  127. public:
  128.     FW_DECLARE_AUTO(FW_CFrameFacetIterator)
  129.     
  130.     FW_CFrameFacetIterator(Environment* ev, const FW_CFrame* frame);
  131.     virtual ~FW_CFrameFacetIterator();
  132. };
  133.  
  134. //========================================================================================
  135. //    class FW_CFacetIterator
  136. //========================================================================================
  137.  
  138. class FW_CFacetIterator
  139. {
  140.  
  141. public:
  142.     FW_DECLARE_AUTO(FW_CFacetIterator)
  143.     
  144.     FW_CFacetIterator(Environment* ev, 
  145.                         ODFacet* facet,
  146.                         ODTraversalType traversalType = kODChildrenOnly,
  147.                         ODSiblingOrder siblingOrder = kODFrontToBack);
  148.     ~FW_CFacetIterator();
  149.  
  150.     ODFacet*        First(Environment* ev)
  151.                         {return fODFacetIterator->First(ev);}
  152.     ODFacet*        Next(Environment* ev)
  153.                         {return fODFacetIterator->Next(ev);}
  154.     FW_Boolean        IsNotComplete(Environment* ev)
  155.                         {return fODFacetIterator->IsNotComplete(ev);}
  156.     void            SkipChildren(Environment* ev)
  157.                         {fODFacetIterator->SkipChildren(ev);}
  158.     
  159. private:
  160.     ODFacetIterator         *fODFacetIterator;
  161. };
  162.  
  163. //========================================================================================
  164. //    class FW_CPresentationFrameIterator
  165. //========================================================================================
  166.  
  167. class FW_CPresentationFrameIterator
  168. {
  169. public:
  170.     FW_DECLARE_AUTO(FW_CPresentationFrameIterator)
  171.     
  172.     FW_CPresentationFrameIterator(Environment* ev, 
  173.                                     FW_CPresentation* presentation);
  174.     FW_CPresentationFrameIterator(Environment* ev, 
  175.                                     FW_CPresentation* presentation, 
  176.                                     ODID frameGroup, 
  177.                                     ODID sequenceNumber);
  178.     ~FW_CPresentationFrameIterator();
  179.  
  180.     FW_CFrame*            First(Environment* ev);
  181.     FW_CFrame*            Next(Environment* ev);
  182.     FW_CFrame*            Last(Environment* ev);
  183.     FW_CFrame*            Previous(Environment* ev);
  184.     FW_Boolean            IsNotComplete(Environment*)
  185.                             {return fCurrentFrame != NULL;}
  186.     
  187. protected:
  188.     FW_CFrame*        GetNext(Environment* ev, FW_CPrivDisplayFrame* displayFrame);
  189.     FW_CFrame*        GetPrevious(Environment* ev, FW_CPrivDisplayFrame* displayFrame);
  190.                                     
  191. private:
  192.     FW_CFrame*                                            fCurrentFrame;
  193.     FW_TOrderedCollectionIterator<FW_CPrivDisplayFrame>    fIterator;
  194.     ODID    fFrameGroup;
  195.     ODID    fSequenceNumber;
  196. };
  197.  
  198. //========================================================================================
  199. //    class FW_CPresentationFacetIterator
  200. //========================================================================================
  201.  
  202. class FW_CPresentationFacetIterator
  203. {
  204. public:
  205.     FW_DECLARE_AUTO(FW_CPresentationFacetIterator)
  206.     
  207.     FW_CPresentationFacetIterator(Environment* ev, FW_CPresentation* presentation);
  208.     ~FW_CPresentationFacetIterator();
  209.  
  210.     ODFacet*        First(Environment* ev);
  211.     ODFacet*        Next(Environment* ev);
  212.     FW_Boolean        IsNotComplete(Environment*)
  213.                         {return fCurrentFacet != NULL;}
  214.  
  215. private:
  216.     ODFacet*        ResetFacetIterator(Environment* ev, FW_CFrame* frame);
  217.     
  218. private:
  219.     FW_CPresentationFrameIterator    fFrameIterator;
  220.     FW_CFrameFacetIterator*            fFacetIterator;
  221.     ODFacet*                        fCurrentFacet;
  222. };
  223.  
  224. //========================================================================================
  225. //    FW_CEmbeddedODFacetsIterator
  226. //========================================================================================
  227.  
  228. class FW_CEmbeddedODFacetsIterator
  229. {
  230. public:
  231.     FW_DECLARE_AUTO(FW_CEmbeddedODFacetsIterator)
  232.     
  233.     FW_CEmbeddedODFacetsIterator(Environment* ev, const FW_MProxy* proxy, ODFacet* embeddingFacet, ODSiblingOrder siblingOrder);
  234.     ~FW_CEmbeddedODFacetsIterator();
  235.  
  236.     ODFacet*        First(Environment* ev);
  237.     ODFacet*        Next(Environment* ev);
  238.     FW_Boolean        IsNotComplete(Environment* ev);
  239.  
  240. private:
  241.     ODFacet*        PrivFindNext(Environment* ev, ODFacet* facet);
  242.     
  243. private:
  244.     ODFacetIterator*    fODFacetIterator;
  245.     ODPart*                fEmbeddedODPart;
  246.     ODID                 fSequenceNumber;
  247.     ODID                fFrameGroup;
  248.     ODFacet*            fODFacet;
  249. };
  250.  
  251. //========================================================================================
  252. //    class FW_CFrameProxyFrameIterator
  253. //========================================================================================
  254.  
  255. class FW_CFrameProxyFrameIterator
  256. {
  257. public:
  258.     FW_DECLARE_AUTO(FW_CFrameProxyFrameIterator)
  259.  
  260.     FW_CFrameProxyFrameIterator(Environment* ev, const FW_CEmbeddingFrame* frame);
  261.     ~FW_CFrameProxyFrameIterator();
  262.  
  263.     FW_CProxyFrame*        First(Environment* ev);
  264.     FW_CProxyFrame*        Next(Environment* ev);
  265.     FW_CProxyFrame*        Last(Environment* ev);
  266.     FW_CProxyFrame*        Previous(Environment* ev);
  267.     FW_Boolean            IsNotComplete(Environment*)
  268.                             {return fCurrentFrame != NULL;}
  269.     
  270. protected:
  271.     FW_CProxyFrame*        GetNext(Environment* ev, FW_MProxy* proxy);
  272.     FW_CProxyFrame*        GetPrevious(Environment* ev, FW_MProxy* proxy);
  273.                                     
  274. private:
  275.     ODID                            fContainerID;
  276.     FW_CProxyFrame*                    fCurrentFrame;
  277.     FW_CPartProxyIterator             fProxyIterator;
  278. };
  279.  
  280. //========================================================================================
  281. //    class FW_CFrameEmbeddedFrameIterator
  282. //========================================================================================
  283.  
  284. class FW_CFrameEmbeddedFrameIterator
  285. {
  286. public:
  287.     FW_DECLARE_AUTO(FW_CFrameEmbeddedFrameIterator)
  288.     
  289.     FW_CFrameEmbeddedFrameIterator(Environment* ev, const FW_CEmbeddingFrame* frame);
  290.     ~FW_CFrameEmbeddedFrameIterator();
  291.  
  292.     ODFrame*        First(Environment* ev);
  293.     ODFrame*        Next(Environment* ev);
  294.     ODFrame*        Last(Environment* ev);
  295.     ODFrame*        Previous(Environment* ev);
  296.     FW_Boolean        IsNotComplete(Environment*)
  297.                         {return fCurrentFrame != NULL;}
  298.  
  299. private:
  300.     ODFrame*        PrivNext(Environment* ev, FW_CProxyFrame* proxyFrame);
  301.     ODFrame*        PrivPrevious(Environment* ev, FW_CProxyFrame* proxyFrame);
  302.                                 
  303. private:
  304.     FW_CFrameProxyFrameIterator     fIterator;
  305.     ODFrame*                        fCurrentFrame;
  306. };
  307.  
  308. //========================================================================================
  309. //    class FW_CFocusSetIterator
  310. //========================================================================================
  311.  
  312. class FW_CFocusSetIterator
  313. {
  314. public:
  315.     FW_DECLARE_AUTO(FW_CFocusSetIterator)
  316.  
  317.     FW_CFocusSetIterator(Environment* ev, const FW_CFrame* frame);
  318.     ~FW_CFocusSetIterator();
  319.     
  320. public:
  321.     ODTypeToken         First(Environment* ev)
  322.                             {return fIterator->First(ev);}
  323.     ODTypeToken         Next(Environment* ev)
  324.                             {return fIterator->Next(ev);}
  325.     FW_Boolean             IsNotComplete(Environment* ev)
  326.                             {return fIterator->IsNotComplete(ev);}
  327.  
  328. private:
  329.     ODFocusSetIterator*        fIterator;
  330. };
  331.  
  332. #endif
  333.